<?php
class Application_Form_User extends Zend_Form{

	public function __construct($options = null)
	{
		parent::__construct($options);
		$this->addElement('text', 'username', array(
            'filters'    => array('StringTrim'),
            'validators' => array(
		array('StringLength', false, array(0, 30)),
		),
            'required'   => true,
            'label'      => 'Username:',
		));

		$passwFlag = new Zend_Form_Element_Checkbox('passwFlag');
		$passwFlag->setRequired(true);
		$passwFlag->setLabel('Set psw?:');
		$this->addElements(array($passwFlag));
		$this->addElement('password', 'password', array(
            'filters'    => array('StringTrim'),
            'validators' => array(
				array('StringLength', false, array(4, 30)),
			),
            'required'   => true,
            'label'      => 'Password:',
		));
		
		$roles = new Zend_Form_Element_Select('role_id');
		$roles->setLabel('Roles:')
		->setRequired(true);
		$rolesDb = new Project_Role_Table();
		foreach($rolesDb->getRoles() as $role)
		{
			$roles->addMultiOption($role->id, $role->role);
		}
		$this->addElements(array($roles));

		$this->addElement('submit','submit', array(
            'required' => false,
            'ignore'   => true,
            'label'    => 'add'
            ));
	}

}